from django.db import models
from orderform.models import Order
from address.models import Address
from goods.models import GoodsShelf
from utils.models import BaseModel
from user.models import UserInfo


# Create your models here.
class Store(BaseModel):
    name = models.CharField(max_length=32, verbose_name='商家名称')
    synopsis = models.CharField(max_length=108, verbose_name='商家简介')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    order = models.ForeignKey(Order, verbose_name='订单表', on_delete=models.CASCADE, db_constraint=False)
    addr = models.ForeignKey(Address, verbose_name='商家地址', on_delete=models.CASCADE, db_constraint=False)
    goods = models.ForeignKey(GoodsShelf, verbose_name='商品信息', on_delete=models.CASCADE, db_constraint=False)

    class Meta:
        db_table = 'store_data'
        verbose_name = '商家信息'
        verbose_name_plural = '商家信息'

    def __str__(self):
        return self.name
